package com.ctvit.sjk.knowledge.core.page;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;

/**
 * 表格分页数据对象
 *
 * @author heyingcheng
 * @date 2025/3/24
 */
@Getter
@Setter
@ToString
public class TableRecordInfo {

    /**
     * 消息状态码
     */
    private int code;

    /**
     * 消息内容
     */
    private String message;

    /**
     * 分页信息
     */
    private TablePageInfo data;

    @Getter
    @Setter
    @ToString
    public static class TablePageInfo {

        /**
         * 总记录数
         */
        private long total;

        /**
         * 列表数据
         */
        private List<?> records;

        /**
         * 当前页码
         */
        private int current;

        /**
         * 每页显示记录数
         */
        private int size;

    }

    /**
     * 表格数据对象
     */
    public TableRecordInfo() {
        this.data = new TablePageInfo();
    }

    public void setRecords(List<?> list) {
        this.data.setRecords(list);
    }

    public void setTotal(long total) {
        this.data.setTotal(total);
    }

    public void setCurrent(int current) {
        this.data.setCurrent(current);
    }

    public void setSize(int size) {
        this.data.setSize(size);
    }

}
